package com.yf.mp.jobhandler;

import com.xxl.job.core.handler.annotation.XxlJob;
import com.yf.mp.domain.User;
import com.yf.mp.dto.UserInfo;
import com.yf.mp.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/*********************************************************
 ** 通用的定时任务执行器
 ** <br><br>
 ** @ClassName: CommonXxlJob
 ** @author: yangfeng
 ** @date: 2024/11/22 14:24
 ** @version: 1.0.0
 *********************************************************/
@Component
@Slf4j
public class CommonXxlJob {
    @Resource
    private UserService userService;
    @XxlJob("addDataToDbJobHandler")
    public void addDataToDb(){
        User u = new User();
        u.setUsername("顶控科技");
        u.setPassword("mm");
        u.setInfo(new UserInfo(3,"可可","男"));
        u.setId(33L);
        userService.save(u);
    }
}
